#pragma once
#include "Utils.h"
#include <string>
#include <vector>

using namespace std;

class EmailManager
{
public:
    EmailManager(void);
    ~EmailManager(void);

	bool SMSSend(const unsigned int& uiMonitorID);

    bool CreateEmailOnDemand(   const unsigned int& uiMonitorID, 
                                const unsigned int& uiAccountID, 
                                const unsigned char& ucEmailContentType,
                                const string& szEmailFrom,
                                const string& szEmailTo,
                                const string& szEmailCc,
                                const string& szEmailBcc,
                                const VariablesMap& variables,
                                const string& szEmailTemplateName,
                                const string& szEmailSubject,
                                const string& szEmailTemplateText,
                                string& szEmailBody,
                                string& szEmailSender,
                                vector<string>& recipients);

    bool CreateEmailWithUrl(    const unsigned int& uiMonitorID, 
                                const unsigned int& uiAccountID, 
                                const unsigned int& uiResourceID,
                                const unsigned char& ucEmailContentType,
                                const string& szEmailTo,
                                const string& szEmailBcc,
                                const string& szMonitorTitle,
                                const string& szUrl,
                                const unsigned int& uiQtyTriggers,
                                const string& szAttachmentFileName,
                                string& szEmailBody,
                                string& szEmailSender,
                                vector<string>& recipients);

    bool CreateEmailWithChangesSummary(     const unsigned int& uiMonitorID, 
                                            const unsigned int& uiAccountID,
                                            const unsigned int& uiResourceID,
                                            const unsigned char& ucEmailContentType,
                                            const string& szEmailTo,
                                            const string& szEmailBcc,
                                            const string& szMonitorTitle,
                                            const string& szUrl,
                                            const unsigned int& uiQtyTriggers,
                                            const string& szChangesSummary,
                                            const string& szAttachmentFileName,
                                            string& szEmailBody,
                                            string& szEmailSender,
                                            vector<string>& recipients);

    bool CreateEmailWithMonitorError(   const unsigned int& uiMonitorID,
                                        const unsigned int& uiAccountID, 
                                        const unsigned int& uiResourceID,
                                        const unsigned char& ucEmailContentType,
                                        const string& szEmailTo,
                                        const string& szEmailBcc,
                                        const string& szMonitorTitle,
                                        const string& szUrl,
                                        const string& szErrorMessage,
                                        string& szEmailBody,
                                        string& szEmailSender,
                                        vector<string>& recipients);
    
    bool CreateEmailWithDHLError(   const unsigned int& uiMonitorID,
                                    const unsigned int& uiAccountID, 
                                    const unsigned int& uiResourceID,
                                    const string& szMonitorTitle,
                                    const string& szUrl,
                                    const string& szErrorMessage,
                                    const unsigned char& ucEmailContentType,
                                    string& szEmailBody,
                                    string& szEmailSender,
                                    vector<string>& recipients);
    
    bool SendEmail( const string& szEmailBody,
                    const string& szEmailFrom,
                    const vector<string>& recipients);

private:

    void CreateEmail(   const string& szEmailFrom,
                        const string& szEmailTo,
                        const string& szEmailCc,
                        const string& szEmailBcc,
                        const string& szAttachmentFileName,
                        const string& szSubject,
                        const unsigned char& ucEmailContentType,
                        const string& szTemplateText,
                        string& szEmailBody,
                        string& szEmailSender,
                        vector<string>& recipients);
};
